﻿<ribbon:Tab x:Class="XWord.GUI.Views.Fundamental.WordTabView"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared" 
			 xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
             xmlns:cal="http://www.caliburnproject.org"
			 xmlns:uc="clr-namespace:XWord.GUI.UserControls"
			 mc:Ignorable="d" Label="开始" 
			 d:DesignHeight="300" d:DesignWidth="300">
    <ribbon:Group Label="Clipboard" ImageSourceSmall="/Resources/Images/Paste16.png" KeyTipAccessText="ZC" DialogLauncherKeyTipAccessText="FO">
        <ribbon:Group.Variants>
            <ribbon:GroupVariant Priority="10" Size="Small" />
        </ribbon:Group.Variants>
        <!--<ribbon:Button Click="Button_Click" Label="GC"></ribbon:Button>-->
        <ribbon:SplitButton KeyTipAccessText="V" ImageSourceLarge="/Resources/Images/Paste32.png"
                            Label="Paste"
                            Command="ApplicationCommands.Paste" Id="Paste">
            <ribbon:Menu>
                <ribbon:Button KeyTipAccessText="P"
                               Label="Paste"
                               ImageSourceSmall="/Resources/Images/Paste16.png" 
                               Command="ApplicationCommands.Paste" Id="Paste" />
                <ribbon:Button ImageSourceSmall="/Resources/Images/PasteSpecial16.png"
                               Label="Paste Special" KeyTipAccessText="S" Id="Paste" />
                <ribbon:Button ImageSourceSmall="/Resources/Images/PasteHyperlink16.png" Label="Paste Hyperlink" KeyTipAccessText="H" />
            </ribbon:Menu>
        </ribbon:SplitButton>
        <ribbon:StackPanel ItemVariantBehavior="MediumThenSmallWhenSmall">
            <ribbon:Button 
                ImageSourceSmall="/Resources/Images/Cut16.png"
                KeyTipAccessText="X" Command="ApplicationCommands.Cut" />
            <ribbon:Button
                ImageSourceSmall="/Resources/Images/Copy16.png"
                KeyTipAccessText="C" Command="ApplicationCommands.Copy" />
           
        </ribbon:StackPanel>
    </ribbon:Group>
    <ribbon:Group Label="搜索">
        <uc:SearchBar/>
    </ribbon:Group>
	<ribbon:Group Label="单词">
        <ribbon:RibbonGallery ItemsSource="{Binding AlphabetList}" x:Name="AlphabetGallery">
			<ribbon:RibbonGallery.ItemTemplate>
				<DataTemplate>
					<ribbon:Button
                        cal:Message.Attach="[Event Click] = [Action SetSearchWord($this.DataContext)];"
                    ToolTipService.InitialShowDelay="0" Label="{Binding Name}" x:Name="aa" Height="20" Width="38" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
						<ribbon:Button.ToolTip>
							<StackPanel MaxWidth="400">
								<WrapPanel>
									<TextBlock Text="词源："></TextBlock>
									<TextBlock Text="{Binding Etymon}" TextWrapping="Wrap"></TextBlock>
								</WrapPanel>
								<WrapPanel>
									<TextBlock Text="发音规则："></TextBlock>
									<TextBlock Text="{Binding PronounceRule}" TextWrapping="Wrap"></TextBlock>
								</WrapPanel>
							</StackPanel>
						</ribbon:Button.ToolTip>
                        <ribbon:Button.ContextMenu>
                            <ContextMenu cal:Action.TargetWithoutContext="{Binding PlacementTarget.Tag,RelativeSource={RelativeSource Mode=Self}}">
                                <MenuItem Header="修改"
                                                  Click="MenuItem_Click_1"
                                                  ></MenuItem>
                            </ContextMenu>
                        </ribbon:Button.ContextMenu>
                    </ribbon:Button>
				</DataTemplate>
			</ribbon:RibbonGallery.ItemTemplate>
		</ribbon:RibbonGallery>
        <Popup x:Name="Element_AlphabetPopup" PlacementTarget="{Binding ElementName=AlphabetGallery}" Placement="Left"  StaysOpen="True" AllowsTransparency="True"
                       DataContext="{Binding PlacementTarget.DataContext.SelectedAlphabet,RelativeSource={RelativeSource Mode=Self}}">
            <Grid Background="White" MinWidth="200" MaxWidth="700">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>

                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Name}"/>
                <TextBlock Grid.Column="0" Grid.Row="1" Text="词源"></TextBlock>

                <TextBox Grid.Column="1" Grid.Row="1" 
                                 AcceptsTab="true" AcceptsReturn="true"
                                 Text="{Binding Etymon}" TextWrapping="Wrap"/>
                <TextBlock Grid.Column="0" Grid.Row="2" Text="发音规则"></TextBlock>
                <TextBox Grid.Column="1" Grid.Row="2"
                                 AcceptsTab="true" AcceptsReturn="true" Text="{Binding PronounceRule}" TextWrapping="Wrap"/>
                <Button Grid.Column="1" Grid.Row="3" Click="Button_Click" cal:Message.Attach="SaveAlphabet($this)">保存</Button>
            </Grid>


        </Popup>
    </ribbon:Group>
</ribbon:Tab>
